<extend name="Public/base"/>

<block name="body">
    <div class="tw-layout">
    	<div class="tw-list-hd">
            {:isset($info['id'])?'编辑':'新增'}<if condition="$type eq 0">APP导航栏<elseif condition="$type eq 1" />WEB导航栏</if>图片
        </div>
		
	    <div class="tw-list-wrap tw-edit-wrap">
            <form action="__SELF__" method="post" class="form-horizontal ajaxForm">
                <div class="form-item">
                    <label class="item-label">导航名称<span class="check-tips"><b>*</b>（用于显示导航的名称）</span></label>
                    <div class="controls">
                        <input type="text" class="text input-large" name="title" value="{$info.title}" placeholder="导航名称">
                    </div>
                </div>
                <if condition="$type eq 1">
                    <div class="form-item">
                        <label class="item-label">上级导航<span class="check-tips"><b>*</b>（上级导航）</span></label>
                        <div class="controls">
                            <select name="parent_id">
                                <option value="0">顶级导航</option>
                                <volist name="navCategoryTree" id="v">
                                    <option value="{$v.id}" <if condition="$v['id'] eq $info['parent_id']">selected="selected"</if> >{$v.name}</option>
                                </volist>
                            </select>
                        </div>
                    </div> 
                </if>
                <if condition="$type eq 0">
                    <div class="form-item">
                        <label class="item-label">图标图片<span class="check-tips"><b>*</b>（图标图片,请上传80px*80px的图片）</span></label>
                        <div class="controls">
                            <div>
                                <img src="{$info.img}" style="height:129px; width:129px;" id="img_"/>
                            <div>
                            <input type="hidden" value="{$info.img}" name="img" id="img"/>
                            <input class="btn btn-default btn-xs" type="button" value="上传" id="btnUpload" />
                            <input class="btn btn-danger btn-xs" type="button" value="删除" onclick="delFile($('#img').val(), '')" id="btn_delete_" />
                            <if condition="$info.img eq ''">
                                <script>
                                    $("#img_, #btn_delete_").hide();
                                </script>
                            </if>
                        </div>
                    </div>
                </if>

                <div class="form-item">
                    <label class="item-label">链接地址<span class="check-tips"><b>*</b>（用于显示打开内容的链接地址）</span></label>
                    <div class="controls">
                        <input type="text" class="text input-large" name="url" value="{$info.url}" placeholder="链接地址">
                    </div>
                </div> 

                <if condition="$type eq 1">
                    <div class="form-item">
                        <label class="item-label">部长菜单<span class="check-tips"><b>*</b>（针对于部长可以显示的菜单）</span></label>
                        <div class="controls">
                            <if condition="$info.is_boss eq 0">
                                <label class="radio"><input type="radio" value="0" name="is_boss" checked="checked" >是</label>
                                <label class="radio"><input type="radio" value="1" name="is_boss" >否</label>
                            <else  />
                                <label class="radio"><input type="radio" value="0" name="is_boss" >是</label>
                                <label class="radio"><input type="radio" value="1" name="is_boss" checked="checked" >否</label>
                            </if>
                        </div>
                    </div>
                    <div class="form-item">
                        <label class="item-label">管理员菜单<span class="check-tips"><b>*</b>（针对于管理员可以显示的菜单）</span></label>
                        <div class="controls">
                            <if condition="$info.is_manager eq 0">
                                <label class="radio"><input type="radio" value="0" name="is_manager" checked="checked" >是</label>
                                <label class="radio"><input type="radio" value="1" name="is_manager" >否</label>
                            <else  />
                                <label class="radio"><input type="radio" value="0" name="is_manager" >是</label>
                                <label class="radio"><input type="radio" value="1" name="is_manager" checked="checked" >否</label>
                            </if>
                        </div>
                    </div>
                    <div class="form-item">
                        <label class="item-label">业务员菜单<span class="check-tips"><b>*</b>（针对于业务员可以显示的菜单）</span></label>
                        <div class="controls">
                            <if condition="$info.is_member eq 0">
                                <label class="radio"><input type="radio" value="0" name="is_member" checked="checked" >是</label>
                                <label class="radio"><input type="radio" value="1" name="is_member" >否</label>
                            <else  />
                                <label class="radio"><input type="radio" value="0" name="is_member" >是</label>
                                <label class="radio"><input type="radio" value="1" name="is_member" checked="checked" >否</label>
                            </if>
                        </div>
                    </div>
                </if>               
                
                <div class="form-item">
                    <label class="item-label">是否禁用</label>
                    <div class="controls">
                        <if condition="$info.disabled eq 0">
                            <label class="radio"><input type="radio" value="0" name="disabled" checked="checked" >正常</label>
                            <label class="radio"><input type="radio" value="1" name="disabled" >禁用</label>
                        <else  />
                            <label class="radio"><input type="radio" value="0" name="disabled" >正常</label>
                            <label class="radio"><input type="radio" value="1" name="disabled" checked="checked" >禁用</label>
                        </if>
                    </div>
                </div>    

                <div class="form-item">
                    <label class="item-label">排序</label>
                    <div class="controls">
                        <input type="text" class="text input-small" name="sort" value="{$info.sort|default=0}">
                    </div>
                </div>

                <div class="tw-tool-bar-bot">
                    <input type="hidden" value="{$info['id']}" name="id">
                    <input type="hidden" value="{$type}" name="type">
                    <button type="submit" class="tw-act-btn-confirm">提交</button>
                    <button type="button" onclick="goback()" class="tw-act-btn-cancel">返回</button>
                </div>
            </form>
	    </div>
    </div>
</block>

<block name="script">
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/ajaxupload.js"></script>
    <script type="text/javascript" charset="utf-8" src="__COMMON__/js/imgupload.js"></script>
    <script>
        $(function(){
            ajaxUpload('#btnUpload', '#img', 'Nav', '');
        })
    </script>
</block>